#include "../Server/Source/server.hpp"
void Useage2(char *ch[])
{
    std::cout << "Useage: " << ch[0] << " ip"
                                        " port"
              << std::endl;
}

int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        Useage2(argv);
        exit(1);
    }

    Socket _clientfd;
    _clientfd.CreateClient(std::stoi(argv[2]), argv[1]);

    while (1)
    {
        std::string _message = "hello tcp_server";
        _clientfd.Send((char *)_message.c_str(), _message.size());
        std::cout << "send 成功" << std::endl;

        char buffer[1024];
        _clientfd.Recv(buffer, sizeof(buffer) - 1);
        std::cout << "Server echo : " << buffer << std::endl;
    }

    return 0;
}